-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ETagManager
: added test to verify that reading cached data in old format fails gracefully
#1438
Merged
NachoSoto
merged 1 commit into
wip-decodable-3-rebased
from
e-tag-manager-invalid-date-test
Apr 8, 2022
Merged
ETagManager
: added test to verify that reading cached data in old format fails gracefully
#1438
NachoSoto
merged 1 commit into
wip-decodable-3-rebased
from
e-tag-manager-invalid-date-test
Apr 8, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merged
10 tasks
taquitos
approved these changes
Apr 1, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NachoSoto
force-pushed
the
wip-decodable-3-rebased
branch
from
April 1, 2022 20:52
c53e94b
to
7bfbd17
Compare
NachoSoto
force-pushed
the
e-tag-manager-invalid-date-test
branch
from
April 1, 2022 21:06
20a6c57
to
d9d28a0
Compare
NachoSoto
force-pushed
the
wip-decodable-3-rebased
branch
from
April 1, 2022 21:30
7bfbd17
to
0e34e67
Compare
NachoSoto
force-pushed
the
e-tag-manager-invalid-date-test
branch
from
April 1, 2022 21:31
d9d28a0
to
46c7b82
Compare
NachoSoto
force-pushed
the
wip-decodable-3-rebased
branch
2 times, most recently
from
April 6, 2022 21:35
87a2c90
to
27a3ea3
Compare
NachoSoto
force-pushed
the
e-tag-manager-invalid-date-test
branch
from
April 6, 2022 21:36
46c7b82
to
6c51cf0
Compare
…ormat fails gracefully
NachoSoto
force-pushed
the
e-tag-manager-invalid-date-test
branch
from
April 8, 2022 01:23
6c51cf0
to
0cf6383
Compare
NachoSoto
added a commit
that referenced
this pull request
Apr 8, 2022
…ormat fails gracefully (#1438)
NachoSoto
added a commit
that referenced
this pull request
Apr 12, 2022
…ormat fails gracefully (#1438)
NachoSoto
added a commit
that referenced
this pull request
Apr 12, 2022
…rkError` and `BackendError` (#1425) Closes #695 and finishes [CF-195]. Depends on ~~#1431, #1432, #1433, #1437~~. ## Goals: - [x] Handle all requests / response / deserialization errors in `HTTPClient`. Clients of `HTTPClient` will only have to handle the "happy" path: #1431 - [x] `HTTPClient` shouldn't return `Result.success` with failed responses, forcing clients to verify the response is actually a failure: #1431 - [x] Abstract error response deserialization / error creation: #1427 - [x] Abstract attribute error parsing: #1427 - [x] Move response deserialization to `HTTPClient` based on a `ResponseType: Decodable` type, so the completion block will simply return a `Result<HTTPResponse<ResponseType>, Error>` - [x] `ETagManager` should store response `Data` instead of a deserialized `[String: Any]` - [x] Improved error types in `HTTPClient` to fix tests: #1437 - [x] Dealt with non-backwards compatible `ETagManager: #1438 ## Changes: - Replaced `HTTPResponse`'s body from `[String: Any]` to a generic `HTTPResponseBody`. - Created `HTTPResponseBody` to abstract `Decodable` and provide some default implementations for types like `Data,` `[String: Any]` (for backwards compatibility to types that aren't `Decodable` yet), and `Decodable` itself. - New `HTTPResponse.Result` typealias (`Result<HTTPResponse<HTTPResponseBody>, Error>`) used everywhere. This will allow replacing `Error` with a more specific `Error` so we can forward known typed errors, and make sure that we don't end up with the wrong error type, or with a very complex error hierarchy and the details buried in `underlyingError`. - Each layer (only a few for now) has its own error type: `NetworkError`, `BackendError`, `OfferingsManager.Error`. - `HTTPClient` for example has to produce `NetworkError`, operations produce `BackendError` - The parent `BackendError` can have specific errors like `.missingAppUserID`, but also be simply a child error `case networkError(NetworkError)` - All of these conform to a `ErrorCodeConvertible`, so there is a single point of code that converts from simple and readable errors (like `BackendError.emptySubscriberAttributes`, `.unexpectedBackendResponse(.loginResponseDecoding)`) into errors with all the context using `ErrorUtils` - Converted `DNSError` into `NetworkError.dnsError`. Its functionality remains unchanged. - Removed `Backend.RCSuccessfullySyncedKey` and `ErrorDetails.finishableKey` in favor of tested properties on `NetworkError` ### Leftovers There's a few things I've decided to not finish for now: - [ ] `CustomerInfo` still does't conform to `Decodable` (manual deserialization is still supported by the current system): #1496 - `SubscriberAttributeDict` could also be `Codable` - [x] Replace `OfferingsFactory` with `Decodable`: #1435 [CF-195]: https://revenuecats.atlassian.net/browse/CF-195?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow up to #1425.